package cn.wsxiot.regularexp;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 正则表达式的简单使用
 */
public class Main1 {
    public static void main(String[] args) {
        String sql="create table spj(sno char(6),pno char(6),jno char(6),qty int);";
        String sql1 = sql.substring(0, sql.length() - 2);
        String sql2 = sql.substring(sql.length() - 2);
        sql = sql1 + "," + sql2;
        Pattern p = Pattern.compile("(create table [a-zA-Z]+\\()((([a-zA-Z]+ [a-zA-Z]+\\,)|(([a-zA-Z]+ [a-zA-Z]+)\\(\\d+\\)\\,))+)(\\)\\;)");
        Matcher m = p.matcher(sql);
        System.out.println(m.matches());
    }
}
